package chapter1;

import java.util.HashSet;
import java.util.Set;

public class Person
{
	private int age;

	private Set emailAddresses = new HashSet();

	private Set<Event> events;
	// private Set<Event> events = new HashSet();
	private String firstName;

	private int id;
	
	private String lastName;

	public int getAge()
	{
		return age;
	}

	public Set getEmailAddresses()
	{
		return emailAddresses;
	}
	
	protected Set<Event> getEvents()
	{
		return events;
	}

	public String getFirstName()
	{
		return firstName;
	}

	public int getId()
	{
		return id;
	}

	public String getLastName()
	{
		return lastName;
	}

	public void setAge(int age)
	{
		this.age = age;
	}

	public void setEmailAddresses(Set emailAddresses)
	{
		this.emailAddresses = emailAddresses;
	}

	protected void setEvents(Set<Event> events)
	{
		this.events = events;
	}

	public void setFirstName(String firstName)
	{
		this.firstName = firstName;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public void setLastName(String lastName)
	{
		this.lastName = lastName;
	}
	
	public void addToEvent(Event event){
		this.getEvents().add(event);
		event.getParticipants().add(this);
	}
	
	public void removeFromEvent(Event event){
		this.getEvents().remove(event);
		event.getParticipants().remove(this);
	}

}
